//
//  WalletMainTableViewCell.m
//  TenMinDemo
//
//  Created by Shawn Li on 2021/3/8.
//  Copyright © 2021 CYXiang. All rights reserved.
//

#import "WalletMainTableViewCell.h"
#import "NSString+FloatString.h"
@interface WalletMainTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UIView *plhView;
@property (weak, nonatomic) IBOutlet UILabel *info;
@end
@implementation WalletMainTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.title.text = [NSString stringWithFormat:@"%@(BTC)",LCLocalString(@"total_balance")];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWith:(WalletMainModel *)model{
    
    if (model) {
        self.plhView.hidden = YES;
        NSMutableAttributedString *attribut = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"%@",@(model.totalBalanceToBtc)] floatString] attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
        
        [attribut appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" ≈%@ USDT",[[NSString stringWithFormat:@"%@",@(model.totalBalanceToUsdt)] floatString]] attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:12],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#ad91ff"]}]];
        
        
        self.info.attributedText = attribut;
    }else{
        self.plhView.hidden = NO;
    }
    
}

@end
